package cn.laixueit.mapper;

import cn.laixueit.pojo.Brand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper extends BaseMapper<Brand> {
    @Insert("insert into tb_category_brand values(#{cid},#{id})")
    void saveBrandAndCategory(@Param("cid") Long cid,@Param("id") Long id);

    @Select("select * from tb_brand where id in ( select brand_id from tb_category_brand where category_id = #{cid})")
    List<Brand> brandListByCid(Long cid);
}
